<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

</body>
<script>
    //默认解构数组方式
    let arr=[1,2,3];
    let a=arr[0];
    let b=arr[1];
    let c=arr[2];
    console.log(a,b,c);

    //快速解构数组
    let arr=[1,2,3];
    let [a,b,c]=arr;
    console.log(a,b,c);

    //默认解构对象方式
    const person={
        name:"tom",
        age:18,
        language:["java","js"]
    }
    const name=person.name;
    const age=person.age;
    const language=person.language;
    console.log(name,age,language);

    //快速解构对象
    //还可以重命名
    const person={
        name:"tom",
        age:18,
        language:["java","js"]
    }
    const {name:newName,age,language}=person;
    console.log(newName,age,language);

    //字符串常用方法
    let str = "hello.vue";
    console.log(str.startsWith("hello"));
    console.log(str.includes("vue"));

    //字符串模板(包含多行的字符串)
    let str = `hello
    world`;
    console.log(str);

    //字符串模板可以插入变量，表达式，函数
    function test() {
        return "你猜多少";
    }
    let myage = 18;

    let info = `我是song，今年${myage}岁了`;
    let infoplus = `我是song，今年${myage + 10}岁了`;
    let infomax = `我是song，今年${test()}岁了`;
    console.log(info);
    console.log(infoplus);
    console.log(infomax);
</script>
</html>